package com.power.sifa.correction.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import com.power.sifa.correction.model.Crw_rule_night;

import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * 夜间活动设置 持久层(hibernate)
 */

public interface Crw_rule_nightDao extends JpaRepository<Crw_rule_night, Serializable>, JpaSpecificationExecutor<Crw_rule_night>, Repository<Crw_rule_night, Serializable>, Crw_rule_nightDaoCustom<Crw_rule_night, Serializable> {

   @Modifying
   @Transactional
   @Query("delete  from Crw_rule_night s where  s.id in (:ids) ")
   void removeByIds(@Param("ids") List<String> ids);

   @Query(" from Crw_rule_night s where s.id in (:ids) ")
   List<Crw_rule_night> findByRuleIds(@Param("ids") List<String> ruleIds);

   @Query(" from Crw_rule_night s where s.name = :name ")
   List<Crw_rule_night> findByName(@Param("name") String name);
}
